package com.ykdl.member.kid.beans;

import java.io.Serializable;
import java.util.ArrayList;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.ykdl.member.kid.chat.ChatConfig;

import net.wxxr.http.interfaces.IJsonParser;

public class ChatBean implements Serializable,IJsonParser{

	/**
	 * 
      "attachments": [
        
      ],
      "from_actor": {
        "display_name": "何大辉",
        "actor_id": 100000057,
        "avatar": null
      },
      "attachment_type": 0,
      "content": "ds4",
      "created_date": "2015-03-19 18:10:24",
      "created_time": 1426759824.062074,
      "message_id": 692
	 */
	private static final long serialVersionUID = -5548553421369981579L;
	private UserActorBean from_actor ;
	private int attachment_type ;//0文字1是图片
	private String content ;
	private String created_date ;
	private String created_time ;
	private int message_id ;
	private boolean from_self ;
	private int status=ChatConfig.STATUS_SEND_SUCCESS;
	private ArrayList<FileBean> attachments;
	public void setFrom_actor(UserActorBean from_actor) {
		this.from_actor = from_actor;
	}
	public void setAttachment_type(int attachment_type) {
		this.attachment_type = attachment_type;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public void setCreated_date(String created_date) {
		this.created_date = created_date;
	}
	public void setCreated_time(String created_time) {
		this.created_time = created_time;
	}
	public void setMessage_id(int message_id) {
		this.message_id = message_id;
	}
	public void setFrom_self(boolean from_self) {
		this.from_self = from_self;
	}
	public void setAttachments(ArrayList<FileBean> attachments) {
		this.attachments = attachments;
	}
	public ArrayList<FileBean> getAttachments() {
		return attachments;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public boolean isFrom_self() {
		return from_self;
	}
	public UserActorBean getFrom_actor() {
		return from_actor;
	}
	public int getAttachment_type() {
		return attachment_type;
	}
	public String getContent() {
		return content;
	}
	public String getCreated_date() {
		return created_date;
	}
	public String getCreated_time() {
		return created_time;
	}
	public int getMessage_id() {
		return message_id;
	}
	@Override
	public IJsonParser parse(String json) throws Exception {
		// TODO Auto-generated method stub
		Gson   gson = null;
		if(null != json){
			GsonBuilder b = new GsonBuilder();
			gson  = b.create();
			return gson.fromJson(json, ChatBean.class);
		}
		return null;
	}

}
